/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thienphuc.patient.bo.impl;

import java.util.List;
import thienphuc.patient.bo.PhongBanBO;
import thienphuc.patient.dao.PhongBanDAO;
import thienphuc.patient.dao.impl.PhongBanDAOImpl;
import thienphuc.patient.dto.PhongBan;

/**
 *
 * @author QuocDat
 */
public class PhongBanBOImpl implements PhongBanBO {

    private PhongBanDAO phongBanDAO;

    public PhongBanBOImpl() {
        this.phongBanDAO = new PhongBanDAOImpl(PhongBan.class);
    }

    public List<PhongBan> getAll() throws Exception {
        return this.phongBanDAO.findAll();
    }

    public PhongBan getById(int phongBanId) throws Exception {
        return this.phongBanDAO.findById(phongBanId);
    }

    public List<PhongBan> getByTenPhongBan(String tenPhongBan) throws Exception {
        return this.phongBanDAO.findByTenPhongBan(tenPhongBan);
    }

    public List<PhongBan> getByTrangThai(boolean trangThai) throws Exception {
        return this.phongBanDAO.findByTrangThai(trangThai);
    }

    public boolean insertPhongBan(PhongBan phongBan) throws Exception {
        return this.phongBanDAO.save(phongBan);
    }

    public boolean updatePhongBan(PhongBan phongBan) throws Exception {
        return this.phongBanDAO.update(phongBan);
    }
}
